Skip to content

[benchmarks] Microbenchmark for dynamic_routing_table (drt_node perf) - #3

Merged
cong1920 merged 3 commits into
masterfrom
bench/drt-node-perf
Mar 16, 2026
Merged

[benchmarks] Microbenchmark for dynamic_routing_table (drt_node perf)#3
cong1920 merged 3 commits into
masterfrom
bench/drt-node-perf

Conversation

@cong1920

@cong1920 cong1920 commented Mar 16, 2026

Copy link
Copy Markdown
Owner

What

Standalone microbenchmark for dynamic_routing_table to establish a performance baseline for the routing table's insert and lookup operations.

Benchmark covers

  • Route registration (insert) - 152 realistic REST API routes (static, parameterized, nested)
  • Route lookup (hit) - 1,044 concrete URLs x 1,000 reps = ~1M lookups
  • Route lookup (miss) - 7 non-matching URLs x 10,000 reps
  • RSS memory delta (Linux only)

How to run

# From repo root (Linux/WSL)
g++ -O2 -std=c++20 -I libraries/http_server -o bench_drt benchmarks/bench_drt.cc
./bench_drt 7   # 7 iterations, reports median

Current baseline results (WSL2, g++ 9.4, -O2)

Metric master
Insert (ns/op) 285.8
Lookup hit (ns/op) 77.7
Lookup miss (ns/op) 45.4

This serves as the baseline to measure against when optimizing the routing table in the simplify_drt_node branch.

Comment thread benchmarks/bench_drt.cc Outdated
Comment thread benchmarks/bench_drt.cc Outdated

@cong1920 cong1920 left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added two comments

Comment thread benchmarks/bench_drt.cc Outdated
@cong1920

Copy link
Copy Markdown
Owner Author

What

Standalone microbenchmark for dynamic_routing_table to measure the performance impact of the simplify_drt_node branch refactoring.

Benchmark covers

  • Route registration (insert) - 152 realistic REST API routes (static, parameterized, nested)
  • Route lookup (hit) - 1,044 concrete URLs x 1,000 reps = ~1M lookups
  • Route lookup (miss) - 7 non-matching URLs x 10,000 reps
  • RSS memory delta (Linux only)

How to run

g++ -O2 -std=c++20 -I libraries/http_server -o bench_drt benchmarks/bench_drt.cc
./bench_drt 7

Initial results (WSL2, g++ 9.4, -O2)

Metric master simplify_drt_node Delta
Insert (ns/op) 285.8 347.4 +21.5% slower
Lookup hit (ns/op) 77.7 80.7 +3.9% slower
Lookup miss (ns/op) 45.4 45.2 ~same
Note: simplify_drt_node wins on code clarity, ownership semantics, and O(1) table copy - raw lookup/insert throughput is comparable but not faster at this scale.

Can you update the result the initial results table to not include "simplify_drt_node" data and the delta? And update the comment to say this is current test result and will use this as baseline to improve in branch "simplify_drt_node"? I don't want to have the PR description to confuse repo owner, and other readers. Thanks!

@cong1920 cong1920 left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commented again. Will let my local LLM do the work.

@cong1920
cong1920 merged commit ac446b1 into master Mar 16, 2026
0 of 4 checks passed
@cong1920
cong1920 deleted the bench/drt-node-perf branch March 16, 2026 05:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant